﻿using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using DBUtility;
using IDAL;
using Model;

namespace DAL
{
    public class ProductType_Step_Flow : BaseRepository<ProductType_Step_FlowInfo>, IProductType_Step_Flow
    {
        #region 静态变量部分
        private const string PARM_FLOW_PRODUCTTYPEID = "@ProductTypeID";
        #endregion

        #region 数据检索部分
        public IList<ProductType_Step_FlowInfo> LoadEntities()
        {
            return ExcuteSqlToGetEntities("ProductType_Step_View_select");
        }

        public ProductType_Step_FlowInfo LoadEntity<T1>(T1 id)
        {
            return null;
        }
        #endregion


        #region 流程控制部分
        //public bool ProductType_Flow_HasValidSevenStep(string productSN, string productTypeID,string stepItem)
        //{
        //    SqlParameter[] testParms = GetStepParameters();
        //    testParms[0].Value = productSN;
        //    testParms[1].Value = productTypeID;
        //    testParms[2].Value = stepItem;
        //    testParms[3].Direction = ParameterDirection.Output;

        //    sqlHelper.ExecuteNonQuery(sqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "ProductType_Flow_HasValidPostStep", testParms);
        //    bool isvalid = (bool)testParms[3].Value;
        //    return isvalid;
        //}       
        #endregion


        #region 重写基类部分
        public override ProductType_Step_FlowInfo GetEntityRecord(SqlDataReader rdr)
        {
            ProductType_Step_FlowInfo pro = new ProductType_Step_FlowInfo(rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(),
                rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString(),
                rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetValue(10).ToString(), rdr.GetValue(11).ToString(), rdr.GetValue(12).ToString(),
                rdr.GetValue(13).ToString(), rdr.GetValue(14).ToString(), rdr.GetValue(15).ToString(), rdr.GetValue(16).ToString(), rdr.GetValue(17).ToString(),
                rdr.GetValue(18).ToString(), rdr.GetValue(19).ToString(), rdr.GetValue(20).ToString(), rdr.GetValue(21).ToString(), rdr.GetValue(22).ToString());               
            return pro;
        }

        public override ProductType_Step_FlowInfo GetEntityRecord()
        {
            ProductType_Step_FlowInfo pro = new ProductType_Step_FlowInfo();
            return pro;
        }

        public override string GetInsertsp()
        {
            return null;
        }

        public override string GetUpdatesp()
        {
            return null;
        }

        public override string GetDeletesp()
        {
            return null;
        }


        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_FLOW_PRODUCTTYPEID, SqlDbType.NVarChar, 50);
            return Parm;
        }

        public override SqlParameter[] GetParameters()
        {
            return null;
        }

        public override void SetParameters(ProductType_Step_FlowInfo pro, params SqlParameter[] Parms)
        {
        }
        #endregion
    }
}
